package excercise;

import java.util.Scanner;

		// W50000 = charge / 50000;
		// charge = charege % 50000;
		// W10000 = charge / 10000;

public class EX05_Q35 {

	public static void main(String[] args) {
	
	ChangeMoneyVO cmvo = new ChangeMoneyVO();
	
	Scanner sc = new Scanner(System.in);
	System.out.println( "거슬러 받아야 할 금액을 입력해주세요 ");
	int change = sc.nextInt();
	cmvo.setChangeMoney( change );
	
	// 출력
	ChangeMoneyService.trade( cmvo );
			
	} // main

} // class

class ChangeMoneyVO{
	
	private int changeMoney;
	private int won_10;
	private int won_50;
	private int won_100;
	private int won_500;
	private int won_1000;
	private int won_5000;
	private int won_10000;
	private int won_50000;
	
	public ChangeMoneyVO() {	}
	
	public void setChangeMoney ( int changeMoney ) { this.changeMoney = changeMoney; }
	public int getChangeMoney () { return this.changeMoney; }
	
	public void setWon_50000 ( int won_50000) { this.won_50000 = won_50000; }
	public int getWon_50000 () { return this.won_50000; }

	public void setWon_10000 ( int won_10000) { this.won_10000 = won_10000; }
	public int getWon_10000 () { return this.won_10000; }
	
	public void setWon_5000 ( int won_5000) { this.won_5000 = won_5000; }
	public int getWon_5000 () { return this.won_5000; }
	
	public void setWon_1000 ( int won_1000) { this.won_1000 = won_1000; }
	public int getWon_1000 () { return this.won_1000; }
	
	public void setWon_500 ( int won_500) { this.won_500 = won_500; }
	public int getWon_500 () { return this.won_500; }
	
	public void setWon_100 ( int won_100) { this.won_100 = won_100; }
	public int getWon_100 () { return this.won_100; }
	
	public void setWon_50 ( int won_50) { this.won_50 = won_50; }
	public int getWon_50 () { return this.won_50; }
	
	public void setWon_10 ( int won_10) { this.won_10 = won_10; }
	public int getWon_10 () { return this.won_10; }
	
} // ChangeMoneyVO

class ChangeMoneyService {

	static void trade ( ChangeMoneyVO cmvo ) {
		// 임시변수
		int tmp50000;
		int tmp10000;
		int tmp5000;
		int tmp1000;
		int tmp500;
		int tmp100;
		int tmp50;
		int tmp10;
		
		// 5만원권
		tmp50000 = ( cmvo.getChangeMoney() / 50000);
		cmvo.setWon_50000( tmp50000 );
		
		// 1만원권
		if ( tmp50000 >= 1 ){
				tmp10000 = ( cmvo.getChangeMoney() / 10000 ) - ( cmvo.getWon_50000() * 5 );
				cmvo.setWon_10000( tmp10000 );
			}
		else {
				tmp10000 = ( cmvo.getChangeMoney() / 10000 );
				cmvo.setWon_10000( tmp10000 );
			}
		
		// 5천원권
		tmp5000 = ( cmvo.getChangeMoney() % 10000 ) / 5000;
		cmvo.setWon_5000( tmp5000 );
		
		// 1천원권
		if ( tmp5000 >= 1) {
			tmp1000 = ( cmvo.getChangeMoney() % 10000 ) / 1000 - ( cmvo.getWon_5000() * 5 );
			cmvo.setWon_1000( tmp1000 );
		}
		else {
			tmp1000 = ( cmvo.getChangeMoney() % 10000 ) / 1000;
			cmvo.setWon_1000( tmp1000 );
		}
		
		// 500원정
		tmp500 =  ( cmvo.getChangeMoney() % 10000 % 1000 ) / 500;
		cmvo.setWon_500( tmp500 );
		
		// 100원정
		if ( tmp500 >= 1) {
			tmp100 = ( cmvo.getChangeMoney() % 10000 % 1000 ) / 100 - ( cmvo.getWon_500() * 5 );
			cmvo.setWon_100( tmp100 );
		}
		else {
			tmp100 = ( cmvo.getChangeMoney() % 10000 % 1000 ) / 100;
			cmvo.setWon_100( tmp100 );
		}
		
		// 50원정
		tmp50 = ( cmvo.getChangeMoney() % 10000 % 1000 % 100) / 50;
		cmvo.setWon_50( tmp50 );
		                                                                 
		// 10원정
		if ( tmp50 >= 1) {
			tmp10 = ( cmvo.getChangeMoney() % 10000 % 1000 % 100) / 10 - ( cmvo.getWon_50() * 5 );
			cmvo.setWon_10( tmp10 );
		}
		else {
			tmp10 = ( cmvo.getChangeMoney() % 10000 % 1000 % 100 ) / 10;
			cmvo.setWon_10( tmp10 );
		}
		
		System.out.println( "거스름돈" +  cmvo.getChangeMoney() );
		System.out.println( "5만원권 " + cmvo.getWon_50000() );
		System.out.println( "1만원권 " + cmvo.getWon_10000() );
		System.out.println( "5천원권 " + cmvo.getWon_5000() );
		System.out.println( "1천원권 " + cmvo.getWon_1000() );
		System.out.println( "5백원권 " + cmvo.getWon_500() );
		System.out.println( "일백원권 " + cmvo.getWon_100() );
		System.out.println( "오십원권 " + cmvo.getWon_50() );
		System.out.println( "십원권 " + cmvo.getWon_10() );
		
		
		
	} //trade
	
} // ChangeMoneyService

class ChangeMoneyServiceFor {
	
	static void forChange( ChangeMoneyVO cmvo ) {
	// 임시변수
	int charge;
	int money = 0;
	int pay = 0;
	int W50000;
	int W10000;
	int W5000;
	int W1000;
	int W500;
	int W100;
	int W50;
	int W10;
	
	// 반복문, 배열을 이용한 잔돈 처리
	int[] charges = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
	int[] moneys = { 0, 50000, 10000, 5000, 1000, 500, 100, 50, 10 };
	
	charge = money - pay;
	for ( int i = 1; i <= 8; ++i ) {
		charges[i] = charge / moneys[i];
		charge = charge % moneys[i];
		System.out.println( moneys[i] + "/" + charges[i] );
		
	}
	
	} // forchange
	
} // ChangeMoneyServiceFor